//电话
function judgephone(){
    var phone=document.getElementById("phone");
    var regExp = new RegExp("^1[356789]\\d{9}$");
    if(!regExp.test(phone.value)){
        alert("电话格式错误");
        return false;
    }else {
        return true;
    }


}
// 验证码格式
function judgeyanzheng(){
    var yanzheng=document.getElementById("yanzheng");
    if(yanzheng.value.length<4){
        alert("验证码格式错误");
        return false;
    }
    else {
        return true;
    }
}
//密码难度
var password=document.getElementById("password1");
password.onkeyup=function(){
    let div=document.querySelectorAll('.g-form .u-content div');
    if(password.value.length==0){
        div[0].style.backgroundColor='#eeeeee';
        div[1].style.backgroundColor='#eeeeee';
        div[2].style.backgroundColor='#eeeeee';
    }
    else if(password.value.length>0 && password.value.length<6){

        div[0].style.backgroundColor='green';
        div[1].style.backgroundColor='#eeeeee';
        div[2].style.backgroundColor='#eeeeee';
    }
    else if(password.value.length>=6 && password.value.length<10){
        div[0].style.backgroundColor='orange';
        div[1].style.backgroundColor='orange';
        div[2].style.backgroundColor='#eeeeee';
    }
    else if(password.value.length>=10){
        div[0].style.backgroundColor='red';
        div[1].style.backgroundColor='red';
        div[2].style.backgroundColor='red';
    }
}
function judgeagain(){
    var password2=document.getElementById("password2");
    var password1=document.getElementById("password1");
    if (password2.value!=password1.value){
        alert("密码不一致");
        return false;
    }else {
        return true;
    }
}

function judge(){
    if(judgephone()===true&&judgeyanzheng()===true&&judgeagain()===true){
        alert("注册成功");
        return false;
    }
}







